<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">

        <div><?php include "../public_flow/flow_show_info.php";?></div>

        <div class="table-box tablenes">
            <div class="title">基本信息</div>
            <table class="layui-table">
                <tbody>

                <tr><td class="tt">开票登记单号</td><td id="number" colspan="3" class="tv"></td></tr>
                <tr><td class="tt">项目名称</td><td id="enginname" class="colorlan tv"></td><td class="tt">合同名称</td><td id="shiname" class="tv colorlan"></td></tr>
                <tr><td class="tt">开票金额含税(元)</td><td id="money" class="tv"></td><td class="tt">发票类型</td><td id="piaotype" class="tv"></td></tr>
                <tr><td class="tt">税率(%)</td><td id="rate" class="tv"></td><td class="tt">税额(元)</td><td id="ratefee" class="tv"></td></tr>
                <tr><td class="tt">受票单位</td><td id="duier" class="tv"></td><td class="tt">纳税人识别号</td><td id="ratenum" class="tv"></td></tr>
                <tr><td class="tt">开户行</td><td id="bankname" class="tv"></td><td class="tt">账号</td><td id="banknum" class="tv"></td></tr>
                <tr><td class="tt">地址</td><td id="unitaddr" class="tv"></td><td class="tt">电话</td><td id="phone" class="tv"></td></tr>
                <tr><td class="tt">施工地点</td><td id="shidian" class="tv"></td><td class="tt">开票单位</td><td id="kaier_name" class="tv"></td></tr>

                <tr><td class="tt">税费收取方式</td><td id="rateshoutype" class="tv"></td><td class="tt">税费金额(元)</td><td id="shuijinfee" class="tv"></td></tr>
                <tr class="layui-hide piaoqian"><td class="tt">关联项目收款</td><td id="incenid_name" class="tv colorlan" colspan="3"></td></tr>
                <tr class="layui-hide piaohou"></td><td class="tt">月利率(%)</td><td id="rateyue" class="tv" colspan="3"></td></tr>


                <tr><td class="tt">备注</td><td class="tv" id="explain" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>

        <div><?php include "../public/upinfo_show.php";?></div>

        <div><?php include "../public_flow/flow_show_flowrelas.php";?></div>

        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo">发票明细<span class="colorhui">（申请通过后，由财务填写）</span></script>
            <div class="tableShow">
                <table id="datalist" lay-filter="datalist"></table>
            </div>
        </div>

        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo_kuan">收款明细</script>
            <div class="tableShow">
                <table id="datalist_kuan" lay-filter="datalist_kuan"></table>
            </div>
        </div>

        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>
</div>
<script>
    var param_id = getQueryVariable('id') || 0;

    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_piao_kai_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;

                if(engininfo){
                    $("#enginname").text(engininfo.name).click(function () {
                        openPage('../engin/show.php?id='+engininfo.id);
                    });
                    if(engininfo.shiid){
                        $("#shiname").text(engininfo.shiname).click(function () {
                            openPage('../contract_shi/show.php?id='+engininfo.shiid);
                        });
                    }

                }




                $("#number").text(data.number);
                $("#money").text(data.money);
                $("#rate").text(data.rate);
                $("#ratefee").text(data.ratefee);
                $("#piaotype").text(data.piaotype);
                $("#duier").text(data.duier);
                $("#ratenum").text(data.ratenum);
                $("#bankname").text(data.bankname);
                $("#banknum").text(data.banknum);
                $("#unitaddr").text(data.unitaddr);
                $("#phone").text(data.phone);
                $("#shidian").text(data.shidian);
                $("#kaier_name").text(data.kaier_name);
                $("#dt").text(data.dt);
                $("#baner").text(data.baner);
                $("#rateshoutype").text(data.rateshoutype);
                $("#rateshoutype2").text(data.rateshoutype);
                $("#rateyue").text(data.rateyue);
                $("#shuijinfee").text(data.shuijinfee);
                $("#explain").text(data.explain);

                if(data.rateshoutype == '票前收税'){
                    $(".piaoqian").removeClass('layui-hide');
                    var incenidinfo = res.data.incenidinfo;
                    $("#incenid_name").text(incenidinfo.sericnum).click(function () {
                        openPage('../income_engin/show.php?id='+incenidinfo.id);
                    });
                }else  if(data.rateshoutype == '票后收税'){
                    $(".piaohou").removeClass('layui-hide');
                }



                var mytableList = table.render({
                    elem: "#datalist",data:res.data.list, toolbar: '#toolbarDemo', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text,totalRow: true
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',totalRowText: '合计',fixed:'left'}
                        ,{field: 'nums', title: '发票号码'}
                        ,{field: 'fee', title: '不含税金额(元)',totalRow: true}
                        ,{field: 'rate', title: '税率(%)',totalRow: true}
                        ,{field: 'ratefee', title: '税额(元)',totalRow: true}
                        ,{field: 'money', title: '价税合计(元)',totalRow: true}
                        ,{field: 'explain', title: '备注'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });

                var mytableList22 = table.render({
                    elem: "#datalist_kuan",data:res.data.acclist, toolbar: '#toolbarDemo_kuan', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text,totalRow: true
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',totalRowText: '合计',fixed:'left'}
                        ,{field:'',title:'关联单据',templet: function(d){
                                return '<span class="colorlan" onclick="openPage(\'../'+d.midinfo.mid_page+'/show.php?id='+d.midinfo.mid+'\')">'+d.midinfo.mid_number+'</span>';
                            }}
                        ,{field: 'enginname', title: '项目名称'}
                        ,{field: 'jiaonum', title: '交易单号'}
                        ,{field: 'money', title: '交易金额(元)',totalRow: true}
                        ,{field: 'dt', title: '交易日期'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });


                public_flow_show_display(res.data.billinfo);
                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('piao_kai', param_id);
    });



</script>
</body>
</html>




